home *** CD-ROM | disk | FTP | other *** search
/ Software of the Month Club 2000 October / Software of the Month - Ultimate Collection Shareware 277.iso / pc / PROGRAMS / UTILITY / WINLINUX / DATA1.CAB / usr_-_Usr_Files / BIN / LSDEV < prev    next >
Text File  |  1999-09-17  |  2KB  |  66 lines

  1. #!/usr/bin/perl
  2. #
  3. #    lsdev.pl
  4. #
  5. #    Created by Sander van Malssen <svm@ava.kozmix.cistron.nl>
  6. #
  7. #    Date:        1996-01-22 19:06:22
  8. #    Last Change: 1998-05-31 15:26:58
  9. #
  10. # $Id: lsdev.pl,v 1.4 1998/05/24 14:53:37 svm Exp svm $
  11. #
  12.  
  13. # MAIN #######################################################################
  14.  
  15. open (IRQ, "</proc/interrupts") || die "can't open /proc/interrupts";
  16. while (<IRQ>) {
  17.     next if /^[ \t]*[A-Z]/;
  18.     chop;
  19.     if (/PIC/) {
  20.     $n = (@line = split());
  21.     } else {
  22.     $n = (@line = split(' [ +] '));
  23.     }
  24.     $name = $line[$n-1];
  25.     $device{$name} = $name;
  26.     @tmp = split(':', $line[0]);
  27.     $tmp0 = int($tmp[0]);
  28.     $irq{$name} = "$irq{$name} $tmp0";
  29. }
  30. close (IRQ);
  31.  
  32. open (DMA, "</proc/dma") || die "can't open /proc/dma";
  33. while (<DMA>) {
  34.     chop;
  35.     @line = split(': ');
  36.     @tmp = split (/[ \(]/, $line[1]);
  37.     $name = $tmp[0];
  38.     $device{$name} = $name;
  39.     $dma{$name} = "$dma{$name}$line[0]";
  40. }
  41. close (DMA);
  42.  
  43. open (IOPORTS, "</proc/ioports") || die "can't open /proc/ioports";
  44. while (<IOPORTS>) {
  45.     chop;
  46.     @line = split(' : ');
  47.     @tmp = split (/[ \(]/, $line[1]);
  48.     $name = $tmp[0];
  49.     $device{$name} = $name;
  50.     $port{$name} = "$port{$name} $line[0]";
  51. }
  52. close (IOPORTS);
  53.  
  54. printf ("%-16s %4s%6s %s\n------------------------------------------------\n",
  55.     "Device", "DMA", "IRQ", " I/O Ports");
  56.  
  57. foreach $name (sort { uc($a) cmp uc($b) } keys %device) {
  58.     printf ("%-16s %4s%6s %s\n",
  59.         $name, $dma{$name}, $irq{$name}, $port{$name});
  60. }
  61.  
  62. # The End ####################################################################
  63.  
  64. # Local variables:
  65. # rm-trailing-spaces: t
  66.